﻿package core.ui.dialogs
{
    import core.enum.*;
    import core.event.*;
    import core.image.*;
    import core.ui.controls.*;
    import core.ui.util.*;
    import flash.events.*;

    public class TriToneDialog extends BitmapOperationDialogBase
    {
        var f:Filter;
        var shadow:ColorPad;
        var mid:ColorPad;
        var high:ColorPad;

        public function TriToneDialog(param1:Tuyitu)
        {
            super(param1, "rm_tritone", 240, 130, Action.TriToneFilter);
            this.f = new Filter();
            var _loc_2:* = new Literal("rm_color");
            _loc_2.x = 15;
            _loc_2.y = 55;
            addChild(_loc_2);
            this.shadow = new ColorPad(7340032, true);
            this.shadow.addEventListener(MouseEvent.MOUSE_DOWN, this.ColorMouseDown);
            this.shadow.addEventListener(ColorPadEvent.CHOOSE_COLOR, this.Change);
            this.shadow.x = 80;
            this.shadow.y = 55;
            addChild(this.shadow);
            this.mid = new ColorPad(5984, true);
            this.mid.addEventListener(MouseEvent.MOUSE_DOWN, this.ColorMouseDown);
            this.mid.addEventListener(ColorPadEvent.CHOOSE_COLOR, this.Change);
            this.mid.x = 130;
            this.mid.y = 55;
            addChild(this.mid);
            this.high = new ColorPad(16777215, true);
            this.high.addEventListener(MouseEvent.MOUSE_DOWN, this.ColorMouseDown);
            this.high.addEventListener(ColorPadEvent.CHOOSE_COLOR, this.Change);
            this.high.x = 180;
            this.high.y = 55;
            addChild(this.high);
            return;
        }// end function

        public function ColorMouseDown(event:MouseEvent) : void
        {
            new ColorPicker(ed, event.target as ColorPad);
            return;
        }// end function

        override public function Change(... args) : void
        {
            if (!locked)
            {
                bm.copyPixels(bc, bm.rect, bm.rect.topLeft);
                this.f.TriTone(bm, bc, this.shadow.value, this.mid.value, this.high.value, selection, offset);
            }
            return;
        }// end function

    }
}
